//判断其是否为回文结构。
public class PalindromeList {
    class ListNode {
        int val;
        ListNode next;
        public ListNode(int val) {
            this.val = val;
        }
    }
    public ListNode head;
        public boolean chkPalindrome(ListNode A) {
            ListNode slow = A;
            ListNode fast = A;
            while (fast != null && fast.next != null) {
                fast = fast.next.next;
                slow = slow.next;
            }
            ListNode cur = slow.next;
            while (cur != null) {
                ListNode curNext = cur.next;
                cur.next = slow;
                slow = cur;
                cur = curNext;
            }
            while (slow != A) {
                if (slow.val == A.val) {
                    slow = slow.next;
                    A= A.next;
                } else {
                    return false;
                }
                if(A.next==slow){
                    return true;
                }

            }
            return  true;
        }
    }
